# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-telnetsrv
pkgname=('python2-telnetsrv' 'python-telnetsrv')
_pkgname=telnetsrv
pkgver=0.4
pkgrel=10
pkgdesc='Telnet server handler library.'
arch=('any')
url='https://pypi.org/project/telnetsrv/#files'
license=('GPL3')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('75c69378fecc5f344560d05f2195d9832add03c53a2955b95b030e2f72da3351cc9712fedd08ae576f2e175f8a887f3bc3f67155760fdc2749cb270cef5d4fba')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-telnetsrv() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-telnetsrv() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

